#include "HttpServer.hpp"
#include <memory>
static const string SEP = "\r\n";

std::string HandlerHttp(const std::string &request)
{
    // 确信，request一定是一个完整的http请求报文
    // 给别人返回的是一个http response
    std::cout << "----------------------------------------" << std::endl;
    std::cout << request << std::endl;
    string resp = "HTTP/1.1 200 ok" + SEP;
    resp += SEP;
    resp += "This is a test,Thank you!";
    return resp;
}

int main(int arc, char *args[])
{
    uint16_t port = atoi(args[1]);
    std::unique_ptr<HttpServer> tsvr(new HttpServer(HandlerHttp, port)); // TODO
    tsvr->InitServer();
    tsvr->Start();

    return 0;
}